<!-- //
// iterate through all the navigation ULs
// in order to hide the subitems ONLY if javascript is on
// if javascript is turned off, just show the expanded navigation tree all the time
// thus staying out of accessibility trouble
// and staying out of trouble with the 'i don't have javascript' whiners.
var lftnv=document.getElementById("leftNav");
if (lftnv) {

	var AllULs = lftnv.getElementsByTagName("ul");
	// alert(AllDivs.length);
	var numULs = AllULs.length;
	for (i=0; i < numULs; i++) {
		if (AllULs[i].className == "detailContainer") {
//Modified on Nov 04, 2020 
//              AllULs[i].style.display = "none";
		AllULs[i].style.display = "block";
		}
	}
        var AllULs = lftnv.getElementsByTagName("ul");
        var numULs = AllULs.length;
        for (i=0; i < numULs; i++) {
           if (AllULs[i].className == "detailContainer_1") {
               AllULs[i].style.display = "none";
           }
        }
// this part figures out what the current page's file name is;
// then that filename is compared to the id of all the li's in the navigation system
// the li with an id that matches the current file name 
// is made red, gets a title that says it's the current page
// and gets '>>' at the end, all to indicate that 'you are here'.

	var currentLocation = document.location;
	var currentLocationText = new String(currentLocation);
	var currentLocationTextEnd = (currentLocationText.length - 4);
	var lastSlash = currentLocationText.lastIndexOf('/');
	var dropAnchors = currentLocationText.lastIndexOf('#');
	
	var startFileName = lastSlash + 1;

	if (dropAnchors != -1) {
	  var EndOfFileName = dropAnchors - 4;
	  var fileText = currentLocationText.slice(startFileName,EndOfFileName);
        } else {
	  var fileText = currentLocationText.slice(startFileName, currentLocationTextEnd);
        }

	if (lastSlash == (currentLocationText.length-1)) {
		fileText = 'index';
	}
	
	expndLists(fileText);
}



function expndLists(menuName) {

	var Lists = document.getElementsByTagName("ul");
	var numLists = Lists.length;

	var listItems = lftnv.getElementsByTagName("li");
	var numListItems = listItems.length;
	// window.alert(fileText);

	for (i=0; i < numListItems; i++) {
	
		if (listItems[i].id == menuName || (listItems[i].id == "DataProducts" && menuName == "QuikSCATData")) {
	
		
	            if(listItems[i].childNodes.length == 1) {
		         listItems[i].firstChild.id = "activeLink";
		     } 
		     
		    if(listItems[i].childNodes.length > 2){
		
		         listItems[i].childNodes[2].className = "showDetailContainer";
		         listItems[i].childNodes[2].style.display = "block";
		         listItems[i].childNodes[2].style.backgroundColor = "#6886d3";
		
		     }

		  
	            // window.alert('recognized child state properly');
		    listItems[i].parentNode.className = "showDetailContainer";
		    listItems[i].parentNode.style.display = "block";
		    listItems[i].parentNode.style.backgroundColor = "#6886d3";
		   
		    if ((listItems[i].parentNode.parentNode.parentNode.tagName == "ul") && 
		       (listItems[i].parentNode.parentNode.parentNode.className != "contentList")) {
					listItems[i].parentNode.parentNode.parentNode.className = "showDetailContainer";
					listItems[i].parentNode.parentNode.parentNode.style.display = "block";
					listItems[i].parentNode.parentNode.parentNode.style.backgroundColor = "#6886d3";
		    }
		   
		    if ((listItems[i].parentNode.parentNode.parentNode.parentNode.parentNode.tagName == "ul") &&
				(listItems[i].parentNode.parentNode.parentNode.parentNode.parentNode.className != "contentList")) {
					listItems[i].parentNode.parentNode.parentNode.parentNode.parentNode.className = "showDetailContainer";
					listItems[i].parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "block";
					listItems[i].parentNode.parentNode.parentNode.parentNode.parentNode.style.backgroundColor = "#6886d3";
		    }




		   var textNow = listItems[i].firstChild.innerHTML;
		   // window.alert(textNow);
	           //listItems[i].firstChild.className = "showDetailContainer";
		  //listItems[i].firstChild.style.display = "block";
		   listItems[i].firstChild.innerHTML = textNow + " >>";
		   listItems[i].firstChild.title = "this is the current page";
		   listItems[i].firstChild.id = "activeLink";
		   
		   break;
				
		}
	}
}


function expndFormFields(testname) {
	
	var parName=testname
	var listItems = document.getElementsByName("region");
	var numLists = listItems.length;

	//window.alert("sdfdsgfdsg");
	//window.alert(testname);
        var selPar=document.forms[0].select;
	//parName=selPar.options[selPar.selectedIndex].value
	//parName=document.forms[0].select.value

	for (i=0; i < numLists; i++) {
		 //window.alert(listItems[i].parentNode.className);
	
            if(listItems[i].parentNode.className == parName){
		    listItems[i].parentNode.style.display = "block";
            } else {
	        listItems[i].parentNode.style.display = "none";
	    
	    }
				
		
	}
}


function StormOnOFF(testname) {
	
	var parName=testname
	var myStorm = document.getElementsByName("mystorm");
	var myMonth = document.getElementsByName("mymonth");
	var myDay = document.getElementsByName("myday");
 	var stmLabel = document.getElementById("stmlabel");
 	var monthLabel = document.getElementById("monthlabel");
  	var dayLabel = document.getElementById("daylabel");
         

            if('storm' == parName){

                myStorm[0].style.display = "inline";
                //stmLabel.style.display = "table";

	        myMonth[0].style.display = "none";
	        myDay[0].style.display = "none";
                monthLabel.style.display = "none";
                dayLabel.style.display = "none";

		document.NavDataBySATs.submit();
            
            } else {
                if('wsm' == parName || 'tbm' == parName || 'icb' == parName || 'icc' == parName){

                   myStorm[0].style.display = "none";
                   stmLabel.style.display = "none";
                   monthLabel.style.display = "none";
                   dayLabel.style.display = "none";
                   myMonth[0].style.display = "none";
                   myDay[0].style.display = "none";
                } else {
	      	   myStorm[0].style.display = "none";
                   stmLabel.style.display = "none";
                   monthLabel.style.display = "table";
                   dayLabel.style.display = "table";
   	           myMonth[0].style.display = "inline";
	           myDay[0].style.display = "inline";
	        }
	    }
}

var select = document.getElementById('mySelect');
if(document.getElementById('mySelect')){
	select.onchange = function () {
    select.className = this.options[this.selectedIndex].className;
	}
}
//-->
